<template>
  <div class="warp">
    <div class="title">
      <p>成都康莱商贸有限公司</p>
      <router-link to="qilinfenlei">
        <i class="iconfont icon-fanhui1"></i>
      </router-link>
    </div>
    <div class="inpt">
      <input type="text" value class="ipt">
      <i class="iconfont icon-sousuo"></i>
    </div>
    <div class="con">
      <div class="con_one">
        <ul class="list">
          <li @click="gett('shelvesTime',0)" :class="{select:num==0}">默认</li>
          <li @click="gett('salesVolume',1)" :class="{select:num==1}">销量</li>
          <li style="margin-right:0" @click="gett('orderPrice',2)" :class="{select:num==2}">价格</li>
        </ul>
      </div>
      <div class="con_tow">
        <label for="loulou" class="loulou" v-if="clic">
          <input type="checkbox" id="loulou">
          <!-- <div class="check_container"></div> -->
          <span class="sp">仅显示有货</span>
        </label>
        <label class="loulou2" style="margin-left:1rem;" @click="click">
          <input type="checkbox" id="loulou2" style="color:red;background:red;">
          <!--  -->
          <span style="margin-left:-0.16rem;" class="spa">推荐</span>
        </label>
      </div>
      <div class="con_san" v-if="eee">
        <ul class="list">
          <li v-for="(item,key) in goodses.goodses" :key="key">
            <img :src="item.picsUrl" alt @click="gett">
            <p>{{item.productName}}</p>
            <div class="mony">
              <span style="font-size:0.1rem">￥</span>
              <span>{{item.orderPrice}}</span>
              <span style="font-size:0.1rem;">.00</span>
            </div>
            <div class="zengpin">
              <span class="spa">已售330件</span>
            </div>
            <div class="bootm">
              <span style="margin-left:0.2rem;">1件起批</span>
              <img src="../../assets/ic_shop.png" alt class="bot">
            </div>
          </li>
        </ul>
      </div>
      <div class="con_si" >
        <img src="../../assets/ic_bills_come.png" alt>
        <div style="margin-top:-1.5rem;color:#ccc;">无可售商品</div>
      </div>
    </div>
    
  </div>
</template>
<script>
import Header from "@/components/Header.vue";
import api from "../../utils/api";
import store from "../../store";
import qs from "qs";
import { setTimeout } from "timers";
import axios from "axios";
import Axios from "axios";
import http from "../../utils/http";

export default {
  name: "goodsclass",
  data() {
    return {
      goodses: [],
      num: 0,
      attachment: "",
      res: {},
      orderBy: "",
      itm: 0,
      aaa: true,
      bbb: true,
      ccc: true,
      ddd: true,
      eee: true,
      fff: true
    };
  },
  methods: {
    dj() {
      this.aaa = false;
    },
    dj2() {
      this.bbb = false;
    },
    dj3() {
      this.ccc = false;
    },
    dj4() {
      this.ddd = false;
    },
    dj5() {
      this.eee = false;
    },
    dj6() {
      this.eee = true;
    },
    clic() {
      var con_san = document.querySelector(".con_san");
      var con_si = document.querySelector(".con_si");
      var spa = document.querySelectorAll(".con_tow .loulou2 .spa")[0];
      var loulou = document.querySelector(".con_tow .loulou");
      loulou.onclick = function() {
        con_san.style.display = "block";
        con_si.style.display = "none";
      };
    },
    click() {
      var con_san = document.querySelector(".con_san");
      var con_si = document.querySelector(".con_si");
      var spa = document.querySelectorAll(".con_tow .loulou2 .spa")[0];
      var loulou = document.querySelectorAll(".con_tow .loulou");
      spa.onclick = function() {
        con_san.style.display = "nonw";
        con_si.style.display = "block";
      };
    },
    gett(orderBy, itm) {
      Axios.post(
        "https://web-gateway.newbeescm.com/b2b-app-web/searchGoodsList",
        {
          cityId: 542500000000,
          countyId: 542521000000,
          dealerId: "107",
          groupStoreId: 49915,
          merchantId: 7462,
          orderBy,
          orderWay: 0,
          pageNum: 1,
          pageSize: 20,
          provId: 540000000000,
          stationId: 5,
          saletype: { secondSaletypeName: "测试二级类目" },
          status: 1,
          stock: 1,
          storeId: "8131",
          tagRecommend: 2
        }
      )
        .then(res => {
          console.log(res);
          this.res = res;
          if (res.data.status.statusCode === 0) {
            this.goodses = res.data.result;
            console.log(this.goodses);
          }
        })
        .catch(err => {
          console.log(err);
        });
      this.num = itm;
    }
  },
  mounted() {
    this.gett("shelvesTime", 0);
    this.clic();
    this.click()
  }
};
</script>
<style lang="scss" scoped>
.select{
    color:red;
}
.title {
  width: 100%;
  height: 0.44rem;
  background: #fff;
  color: #333;
  border-bottom: 1px solid #f2f1f6;
  line-height: 0.44rem;
  position: relative;
  .icon-fanhui1 {
    position: absolute;
    left: 0.14rem;
    top: 0;
    font-size: 0.2rem;
  }
}
.inpt {
  width: 100%;
  height: 0.44rem;
  background: red;
  position: relative;
}
.ipt {
  width: 3.47rem;
  height: 0.3rem;
  outline: none;
  border: none;
  border-radius: 0.16rem;
  margin: 0 auto;
  margin-top: 0.06rem;
}
.icon-sousuo {
  font-size: 0.2rem;
  position: absolute;
  left: 0.2rem;
  top: 0.1rem;
}
.con {
  width: 100%;
  .con_one {
    width: 100%;
    height: 0.4rem;
    .list {
      width: 100%;
      height: 0.4rem;
      display: flex;
      justify-content: center;
      align-items: center;
      li {
        margin-right: 0.9rem;
      }
    }
  }
  .con_tow {
    width: 100%;
    height: 0.35rem;
    border: 0.005rem solid #f2f1f6;
    border-left: 0;
    border-right: 0;
    position: relative;
    .loulou {
      position: absolute;
      left: 0.14rem;
      top: 0.1rem;
      span {
        position: absolute;
        left: 0.15rem;
        top: 0.04rem;
        width: 0.8rem;
        font-size: 0.12rem;
      }
    }
    .loulou2 {
      position: absolute;
      left: 0.5rem;
      top: 0.1rem;
      .spa {
        position: absolute;
        left: 0.15rem;
        top: 0.04rem;
        width: 0.8rem;
        font-size: 0.12rem;
      }
    }
  }
}
.con_san {
  .list {
    margin-left: 0.14rem;
    margin-top: 0.13rem;
    box-sizing: border-box;
    li {
      width: 3.47rem;
      height: 1.21rem;
      margin-right: 0.17rem;
      float: left;
      margin-bottom: 0.25rem;
      position: relative;
      img {
        width: 1.6rem;
        height: 1.6rem;
        position: absolute;
        left: 0;
        top: 0;
      }
      p {
        width: 2rem;
        font-size: 0.12rem;
        color: #333;
        margin-top: 0.1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        position: absolute;
        left: 1rem;
        top: 0.1rem;
      }
      .mony {
        position: absolute;
        left: 1.7rem;
        top: 0.6rem;
        color: red;
      }
      .zengpin {
        color: #333;
        font-size: 0.1rem;
        position: absolute;
        left: 1.7rem;
        bottom: -0.1rem;
        .spa {
          padding: 0.02rem;
          border-radius: 0.02rem;
          margin-right: 0.2rem;
        }
      }
      .bootm {
        font-size: 0.1rem;
        color: #999;
        position: relative;
        position: absolute;
        left: 2.2rem;
        top: 0.64rem;
        .bot {
          width: 0.2rem;
          height: 0.2rem;
          position: absolute;
          right: -1rem;
          top: 0.5rem;
          margin-left: 1rem;
        }
      }
    }
  }
}
.con_si {
  width: 100%;
  height: 100%;
  background: #f2f1f6;
  position: fixed;
  display: none;
  img {
    width: 1.34rem;
    height: 0.74rem;
    margin: 50% auto;
  }
}
</style>
